home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 84 / 084.d81 / source codes / HIGH SCORES.EBUD < prev    next >
Text File  |  2022-08-26  |  6KB  |  552 lines

  1. ;Instant high score file
  2.  
  3. open =$ffc0
  4. readst =$ffb7
  5. setlfs =$ffba
  6. setnam =$ffbd
  7. load =$ffd5
  8. getin =$ffe4
  9. clrchn =$ffcc
  10. close =$ffc3   ;a
  11. chrin =$ffcf
  12. chkout =$ffc9  ;x
  13. chkin =$ffc6   ;x
  14. plot =$fff0
  15. chrout =$ffd2
  16. color'pointer =243
  17. screen'line'pointer =209
  18. print'number =$bdcd ;x,a
  19. clear'line =59903
  20.  
  21. .org $c000
  22. .mem
  23. ;obj "scores c000"
  24. jmp menu
  25. jmp load'scores
  26. jmp save'scores
  27. jmp clear'high'scores
  28.  
  29. menu lda #255
  30. sta temp
  31.  
  32. - jsr $aefd 
  33. jsr $ad8a
  34. jsr $b7f7
  35. inc temp
  36. ldy temp
  37. bne +
  38. lda $14
  39. sta petition
  40. lda $15
  41. sta petition+1
  42. + lda $14
  43. sta top'color-1,y
  44. cpy #3
  45. bne -
  46.  
  47. clear'line'links ldy #24
  48. - lda 217,y
  49. ora #128
  50. sta 217,y
  51. dey
  52. bpl -
  53.  
  54. position'to'draw'box ldx #5
  55. ldy #0
  56. clc
  57. jsr plot
  58.  
  59. draw'box ldx #14
  60. - ldy #35
  61.  
  62. - lda #160   ;reverse space
  63.  
  64. sta (screen'line'pointer),y
  65.  
  66. lda middle'color
  67. cpx #14
  68. bne +
  69. lda top'color
  70. jmp +
  71. + cpx #1
  72. bne +
  73. lda bottom'color
  74.  
  75. + sta (color'pointer),y
  76. dey
  77. cpy #3
  78. bne -
  79.  
  80. dex
  81. beq print'names
  82. stx temp
  83. inc 214
  84. jsr 58732
  85. ldx temp
  86. bne --
  87.  
  88. print'names ldx #7
  89. ldy #6
  90. clc
  91. jsr plot
  92.  
  93. fill'empty ldx #10
  94. stx temp
  95. lda middle'color
  96. sta 646
  97.  
  98. inc 199          ;reverse video
  99.  
  100. - ldy #0
  101. - lda default,y
  102. beq print'default'score
  103. jsr chrout
  104. iny
  105. bne -
  106.  
  107. print'default'score lda #28
  108. sta 211
  109. jsr 58732
  110. ldy #0
  111.  
  112. - lda default'score,y
  113. beq finished'defaults
  114. jsr chrout
  115. iny
  116. bne -
  117.  
  118. finished'defaults inc 214
  119. lda #6
  120. sta 211
  121. jsr 58732
  122.  
  123. dec temp
  124. bne ---
  125. jsr search'for'lower'score
  126. lda "0"
  127. bit flag
  128. bvc +
  129. lda "1"
  130. + sta 631
  131. lda #1
  132. sta 198
  133. rts
  134.  
  135.  
  136.  
  137. clear'high'scores ldy #239
  138. lda #0
  139. - sta names,y
  140. dey
  141. cpy #255
  142. bne -
  143. rts
  144.  
  145. load'scores jsr $aefd
  146. jsr $ad9e
  147. jsr $b6a3
  148.  
  149. jsr setnam
  150. lda #2
  151. ldx 186
  152. cpx #8
  153. bcs +
  154. ldx #8
  155. + ldy #2
  156. jsr setlfs
  157. jsr open
  158.  
  159. jsr clrchn
  160. ldx #2
  161. jsr chkin
  162.  
  163. ldy #0
  164.  
  165. - jsr chrin
  166. sta names,y
  167. iny
  168. cpy #240
  169. bne -
  170.  
  171. jsr clrchn
  172. lda #2
  173. jmp close
  174.  
  175. save'scores jsr $aefd
  176. jsr $ad9e
  177. jsr $b6a3
  178.  
  179. jsr setnam
  180. lda #2
  181. ldx 186
  182. cpx #8
  183. bcs +
  184. ldx #8
  185. + ldy #1
  186. jsr setlfs
  187. jsr open
  188.  
  189. jsr clrchn
  190. ldx #2
  191. jsr chkout
  192.  
  193. ldy #0
  194.  
  195. - lda names,y
  196. jsr chrout
  197. iny
  198. cpy #240
  199. bne -
  200.  
  201. jsr clrchn
  202. lda #2
  203. jmp close
  204.  
  205.  
  206. get'line ldy #19
  207. lda #0
  208. clear'string sta string,y
  209. dey
  210. bpl clear'string
  211.  
  212. ldy #35
  213. lda #160
  214. - sta (screen'line'pointer),y
  215. dey
  216. cpy #5
  217. bne -
  218.  
  219. lda #28
  220. sta 211
  221. jsr 58732
  222. lda petition+1
  223. ldx petition
  224. jsr print'number
  225.  
  226. lda #6
  227. sta 211
  228. jsr 58732
  229.  
  230. ldy #19
  231. lda #0
  232. - sta string,y
  233. dey
  234. bpl -
  235. lda #0
  236. sta string'length
  237. sta 198
  238. lda 211
  239. sta starting'position
  240. lda #">"
  241. inc 199;      reverse video
  242. jsr $ffd2
  243. lda #157
  244. jsr $ffd2
  245.  
  246. wait'for'key jsr getin
  247. beq wait'for'key
  248. ;jmp +
  249. bit middle'color
  250. bpl +
  251. pha
  252. lda 653
  253. cmp #1
  254. beq shift'on
  255. pla
  256. jmp +
  257. shift'on pla
  258. bne wait'for'key
  259.  
  260. + cmp #13
  261. beq return   
  262. cmp #20
  263. beq delete
  264.  
  265. cmp #32
  266. bcc wait'for'key
  267. cmp #91
  268. bcc okay'input
  269. cmp #193
  270. bcc wait'for'key
  271. cmp #219
  272. bcc okay'input
  273. jmp wait'for'key
  274.  
  275. return lda " "
  276. jsr chrout
  277. ldx #23
  278. jsr clear'line
  279. rts
  280.  
  281. delete lda string'length
  282. beq wait'for'key
  283. lda #" "
  284. jsr $ffd2
  285. lda #157
  286. jsr $ffd2
  287. jsr $ffd2
  288. lda #"<"
  289. jsr $ffd2
  290. lda #157
  291. jsr $ffd2
  292. dec string'length
  293. jmp wait'for'key
  294.  
  295. okay'input sta temp
  296. lda string'length
  297. cmp #19
  298. beq wait'for'key
  299. tay
  300. lda temp
  301. sta string,y
  302. jsr $ffd2
  303. lda #">"
  304. jsr $ffd2
  305. lda #157
  306. jsr $ffd2
  307. inc string'length
  308. jmp wait'for'key
  309.  
  310. search'for'lower'score lda #0
  311. sta flag
  312. sta slot'number
  313. lda <scores
  314. sta 253
  315. lda >scores
  316. sta 254
  317.  
  318. - lda slot'number
  319. cmp #10
  320. beq ran'out'of'slots
  321.  
  322. ldy #1
  323. lda petition+1
  324. cmp (253),y
  325. bcc next'score
  326. bne insert'names
  327.  
  328. dey
  329. lda petition
  330. cmp (253),y
  331. beq next'score
  332. bcs insert'names
  333.  
  334. next'score inc slot'number
  335. lda 253
  336. clc
  337. adc #2
  338. sta 253
  339. bcc +
  340. inc 254
  341.  
  342. + lda 251
  343. clc
  344. adc #20
  345. sta 251
  346. bcc +
  347. inc 252
  348.  
  349. + jmp -
  350.  
  351. ran'out'of'slots jmp print'stored'names
  352.  
  353. insert'names lda #255
  354. sta flag
  355. jsr print'congrats
  356. lda slot'number
  357. cmp #10
  358. bne +
  359. rts
  360. + tay
  361. lda name'constants,y
  362. sta goal
  363. dec goal
  364.  
  365. ldx #219; destination
  366. ldy #199; source
  367.  
  368. move'names lda names,y
  369. sta names,x
  370. dey
  371. dex
  372. cpy goal
  373. bne move'names
  374.  
  375. insert'scores lda slot'number
  376. tay
  377. lda score'constants,y
  378. sta goal
  379. dec goal
  380.  
  381. ldx #21; destination
  382. ldy #19; source
  383.  
  384. move'scores lda scores,y
  385. sta scores,x
  386. dey
  387. dex
  388. cpy goal
  389. bne move'scores
  390.  
  391. jsr print'stored'names
  392.  
  393. alright lda slot'number
  394. clc
  395. adc #7
  396. tax
  397. clc
  398. ldy #6
  399. jsr plot
  400. jsr get'line
  401.  
  402. lda slot'number
  403. tay
  404. lda score'constants,y
  405. tax
  406. lda petition
  407. sta scores,x
  408. inx
  409. lda petition+1
  410. sta scores,x
  411.  
  412. lda slot'number
  413. tay
  414. lda name'constants,y
  415. tax
  416. ldy #0
  417. - lda string,y
  418. sta names,x
  419. inx
  420. iny
  421. cpy #20
  422. bne -
  423. rts
  424.           
  425. print'stored'names lda <names
  426. sta 251
  427. lda >names
  428. sta 252
  429.  
  430. lda <scores
  431. sta 253
  432. lda >scores
  433. sta 254
  434.  
  435. position'to'print'stored'names ldx #7
  436. ldy #6
  437. clc
  438. jsr plot
  439.  
  440. ldx #10
  441. stx temp
  442. stx 199
  443. lda middle'color
  444. sta 646
  445.  
  446. print'it ldy #0
  447. - lda (251),y
  448. beq pad'out
  449. jsr chrout
  450. iny
  451. cpy #20
  452. bne -
  453.  
  454. pad'out cpy #0
  455. beq print'score
  456.  
  457. lda #32
  458. - jsr chrout
  459. iny
  460. cpy #20
  461. bcc -
  462.  
  463. print'score lda #28
  464. sta 211
  465. jsr 58732
  466. ldy #1
  467. lda (253),y
  468. dey
  469. pha
  470. lda (253),y
  471. tax
  472. pla
  473. jsr print'number
  474.  
  475. ldx temp
  476. cpx #1
  477. beq quit'printing
  478. dex
  479. stx temp
  480.  
  481. lda 251
  482. clc
  483. adc #20
  484. sta 251
  485. bcc +
  486. inc 252
  487.  
  488. + lda 253
  489. clc
  490. adc #2
  491. sta 253
  492. bcc +
  493. inc 254
  494.  
  495. + inc 214
  496. lda #6
  497. sta 211
  498. jsr 58732
  499.  
  500. jmp print'it
  501.  
  502. quit'printing rts
  503.  
  504. print'congrats ldx #23
  505. ldy #4
  506. clc
  507. jsr plot
  508.  
  509. lda middle'color
  510. sta 646
  511.  
  512. bmi ucase
  513.  
  514. ldy #0
  515. sty 199
  516. - lda congrats'script,y
  517. beq +
  518. jsr chrout
  519. iny
  520. bne -
  521. + rts
  522.  
  523. ucase ldy #0
  524. sty 199
  525. - lda congrats'upper,y
  526. beq +
  527. jsr chrout
  528. iny
  529. bne -
  530. + rts
  531.  
  532. flag .byt 0
  533. string .buf 20
  534. string'length .byt 0
  535. starting'position .byt 0
  536. temp .byt 0
  537. default .asc "Empty":.byt 0
  538. default'score .asc "0":.byt 0
  539. petition .word 0
  540. parameter .buf 4
  541. slot'number .byt 0
  542. top'color .byt 1
  543. middle'color .byt 3
  544. bottom'color .byt 14
  545. name'constants .byt 0,20,40,60,80,100,120,140,160,180
  546. score'constants .byt 0,2,4,6,8,10,12,14,16,18
  547. goal .byt 0
  548. congrats'script .asc "Congratulations!  Enter Your Name":.byt 0
  549. congrats'upper .asc "congratulations!  enter your name":.byt 0
  550. names .buf 220
  551. scores .buf 22
  552.